package com.ruoyi.web.controller.ring;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.ring.domain.RingStressChange;
import com.ruoyi.ring.service.IRingStressChangeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 压力详情Controller
 * 
 * @author liuwp
 * @date 2025-09-03
 */
@RestController
@RequestMapping("/ring/ring_stress_change")
public class RingStressChangeController extends BaseController
{
    @Autowired
    private IRingStressChangeService ringStressChangeService;

    /**
     * 查询压力详情列表
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_stress_change:list')")
    @GetMapping("/list")
    public TableDataInfo list(RingStressChange ringStressChange)
    {
        startPage();
        List<RingStressChange> list = ringStressChangeService.selectRingStressChangeList(ringStressChange);
        return getDataTable(list);
    }

    /**
     * 导出压力详情列表
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_stress_change:export')")
    @Log(title = "压力详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, RingStressChange ringStressChange)
    {
        List<RingStressChange> list = ringStressChangeService.selectRingStressChangeList(ringStressChange);
        ExcelUtil<RingStressChange> util = new ExcelUtil<RingStressChange>(RingStressChange.class);
        util.exportExcel(response, list, "压力详情数据");
    }

    /**
     * 获取压力详情详细信息
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_stress_change:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(ringStressChangeService.selectRingStressChangeById(id));
    }

    /**
     * 新增压力详情
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_stress_change:add')")
    @Log(title = "压力详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RingStressChange ringStressChange)
    {
        return toAjax(ringStressChangeService.insertRingStressChange(ringStressChange));
    }

    /**
     * 修改压力详情
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_stress_change:edit')")
    @Log(title = "压力详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RingStressChange ringStressChange)
    {
        return toAjax(ringStressChangeService.updateRingStressChange(ringStressChange));
    }

    /**
     * 删除压力详情
     */
    @PreAuthorize("@ss.hasPermi('ring:ring_stress_change:remove')")
    @Log(title = "压力详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ringStressChangeService.deleteRingStressChangeByIds(ids));
    }

}
